<template>
  <div class="u-p-20">
    <el-card shadow="never">
      <div slot="header">
        <span>
          <b class="u-f-16">推广用户列表</b>
        </span>
      </div>
      <el-form :inline="true" :model="queryForm" size="small" class="u-text-center">
        <el-form-item label="性别">
          <el-select v-model="queryForm.sex" clearable>
            <el-option label="全部" value></el-option>
            <el-option label="男" value="1"></el-option>
            <el-option label="女" value="2"></el-option>
            <el-option label="保密" value="3"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="关键词">
          <el-input v-model="queryForm.keyword" placeholder="输入昵称、手机查询" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="getPageData(true)">查询</el-button>
        </el-form-item>
      </el-form>

      <el-table :data="tableData" class="u-mt-10">
        <el-table-column label="ID" prop="id" width="60"></el-table-column>
        <el-table-column label="头像">
          <template slot-scope="scope">
            <el-image :src="scope.row.head_img" fit="cover" lazy style="width: 48px;"></el-image>
          </template>
        </el-table-column>
        <el-table-column label="昵称" prop="nick_name"></el-table-column>
        <el-table-column label="手机" prop="phone"></el-table-column>
        <el-table-column label="账号状态">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.status==1" type="success">正常</el-tag>
            <el-tag v-else type="info">禁用</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="注册时间" prop="create_time"></el-table-column>
      </el-table>

      <div class="u-mt-20 u-text-center">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handlePageChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 30, 40, 50]"
          :page-size="limit"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
import commonPage from "@/mixins/common-page";
export default {
  mixins: [commonPage],
  props: {
    userId: {
      type: String
    }
  },
  data() {
    return {
      apiName: "user",
      apiPage: "popPage",
      queryForm: {
        user_id: this.userId,
        sex: "",
        keyword: ""
      }
    };
  },
  methods: {}
};
</script>
